import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import home from '@/pages/home/home'
import cate from '@/pages/cate/cate'
import cart from '@/pages/cart/cart'
import user from '@/pages/user/user'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'HelloWorld',
      component: HelloWorld,
      beforeEnter:(to,from,next) =>{
        console.log(to,from);
        next(vm =>{
          console.log(vm);
        });
        next()
      }
    },
    {
      path: '/home',
      name: 'home',
      component: home
    },
    {
      path: '/user',
      name: 'user',
      component: user
    },
    {
      path: '/cate',
      name: 'cate',
      component: cate
    },
    {
      path: '/cart',
      name: 'cart',
      component: cart
    }
  ]
})
